﻿namespace Shortcuts.Common
{
    using Microsoft.Phone.Tasks;
    using System;

    public enum Settings
    {
        WiFi = 0,
        Bluetooth = 1,
        Cellular = 2,
        Airplane = 3,
        All
    }

    public static class SettingsExtensions
    {
        public static ConnectionSettingsType ToConnection(this Settings settings)
        {
            if (settings == Settings.All)
            {
                throw new Exception(string.Format("Settings.{0} to connection error.", settings.Named()));
            }

            return (ConnectionSettingsType)settings;
        }

        public static string Named(this Settings settings)
        {
            return settings.ToString("G");
        }
    }
}
